<include file="Common/header" />
<title>会员列表</title>
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 账单管理
	<span class="c-gray en">&gt;</span> 水电管理
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div class="pd-20">
	<div class="panel panel-primary">
		<div class="panel-header">数据导入</div>
		<div class="pt-10 pd-10">
			<form action="add.html" method="post" class="form form-horizontal" id="fileup" enctype="multipart/form-data">
				<span class="btn-upload form-group">
					<input class="input-text upload-url radius" style="width: 150px;" type="text" name="uploadfile-2" id="uploadfile-2" readonly="">
					<a href="javascript:void();" class="btn btn-primary upload-btn radius"><i class="Hui-iconfont"></i> 浏览文件</a>
					<input type="file" multiple="" name="file" class="input-file" style="width: 100px;">
				</span>
				<a class="btn btn-primary radius submitBtn" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 导入数据</a>
			</form>
		</div>
	</div>
</div>

<div class="pd-20">
	<div class="cl pd-5 bg-1 bk-gray"> 
		<span class="l"></span>
		房间号：<input class="input-text radius" id="roomnumber" name="roomnumber" style="width: 150px; " />
		年份：
		<span class="select-box radius" style="width: 100px;">
			<select class="select" size="1" name="years" id="years" style="width: 80px;">
				<option value="{$years}">{$years}</option>
				<option value="{$byears}">{$byears}</option>
			</select>
		</span>
		月份：
		<span class="select-box radius" style="width: 100px;">
			<select class="select" size="1" name="months" id="months" style="width: 80px;">
				<?php for($i=1;$i<=12;$i++){ ?>
				<option value="<?php echo str_pad($i, 2, 0, STR_PAD_LEFT) ?>" <?php echo $i == date('m') ? 'selected' : ''; ?>>{$i}月</option>
				<?php } ?>
			</select>
		</span>
		<a href="javascript:;" class="btn btn-success radius querys"><i class="Hui-iconfont">&#xe709;</i> 查询</a> 
		<a class="btn btn-danger radius explode" href="javascript:;"><i class="Hui-iconfont">&#xe644;</i> 导出下月模板</a>
		<a class="btn btn-danger radius explode2" href="javascript:;"><i class="Hui-iconfont">&#xe644;</i> 导出总表数据</a>
	</div>
	<div class="dataTables_wrapper no-footer" id="ajaxDiv">
		<include file="Hydropower/lists" />
	</div>
</div>
<script src="__PUBLIC__/h-ui/lib/jquery.form.js"></script>
<script type="text/javascript">
	/*管理员-角色-添加*/
	function admin_role_add(title,url,w,h){
		layer_show(title,url,w,h);
	}
	
	/*管理员-角色-编辑*/
	function admin_role_edit(title,url,id,w,h){
		layer_show(title,url,w,h);
	}
	
	$(document).ready(function(){
		$(".time").on('click', function(){
			laydate({istime: true, format: 'YYYY-MM'});
		});
		
		//按条件查询
		$(".querys").on('click', function(){
			var load = layer.load(2);
			var where = {};
				where.roomnumber = $("#roomnumber").val();
				where.ajax = 1;
				where.month = $("#years").val() + '-' + $("#months").val();
			$.get('index.html', where, function(data){
				layer.close(load);
				$("#ajaxDiv").html(data);
			});
		});
		
		//上传文件
		$(".submitBtn").on('click', function(){
			var load = layer.load(2);
			$("#fileup").ajaxSubmit({
				type:'post',
				url:'add.html',
				success:function(data){
					layer.close(load);
					if(data == '上传文件成功'){
						layer.msg(data, {icon: 1, time: 2000}, function(){
							var where = {};
								where.roomnumber = $("#roomnumber").val();
								where.ajax = 1;
								where.month = $("#month").val();
							$.get('index.html', where, function(data){
								$("#ajaxDiv").html(data);
							});
						});
					}else{
						layer.msg(data, {icon: 2, time: 2000});
					}
				},
				error:function(XmlHttpRequest,textStatus,errorThrown){
					layer.close(load);
				}
			});    
		});

		//导出数据
		$(".explode").on('click', function(){
			location.href = 'exportTemp.html?years='+ $("#years").val()+'&month='+ $("#months").val();
		});
		
		$(".explode2").on('click', function(){
			location.href = 'export.html?years='+ $("#years").val();
		});
	});
</script>
</body>
</html>